/*
 * Copyright 2020 DuJiang.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.amorou.rest.crypto.util;

/**
 * CryptoUtils
 * 
 * @author DuJiang
 */
public final class CryptoUtils {

	/**
	 * RSA 加密
	 * @param encryptText
	 * @param publicKey
	 * @param charset
	 * @return String
	 */
	public static final String rsaEncrypt(final String encryptText, final String publicKey, final String charset) {
		return RSAUtils.encrypt(encryptText, publicKey, charset);
	}

	/**
	 * RSA 解密
	 * @param decryptText
	 * @param privateKey
	 * @param charset
	 * @return String
	 */
	public static final String rsaDecrypt(final String decryptText, final String privateKey, final String charset) {
		return RSAUtils.decrypt(decryptText, privateKey, charset);
	}

	/**
	 * AES 加密
	 * @param encryptText
	 * @param key
	 * @param iv
	 * @param charset
	 * @return String
	 */
	public static final String aesEncrypt(final String encryptText, final String key, final String iv, final String charset) {
		return AESUtils.encrypt(encryptText, key, iv, charset);
	}

	/**
	 * AES 解密
	 * @param decryptText
	 * @param key
	 * @param iv
	 * @param charset
	 * @return String
	 */
	public static final String aesDecrypt(final String decryptText, final String key, final String iv, final String charset) {
		return AESUtils.decrypt(decryptText, key, iv, charset);
	}

}
